package Day202;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * @author zdl
 * @date 2024/11/5
 */
public class Demo2 {

    public static void main(String[] args) {
        double d1 = 12.2;
        float f1 = 9.1F;
        System.out.println(d1++);
        System.out.println(d1);

        double d2 = d1++ + --f1 + ++d1;
        //          12.2 + 9.1  + 14.2
        System.out.println(d2);

        int a = 2;
        float b = 2.0f;
        System.out.println(a == b);

        double c = 1.0;
        float d = 2.0f;
        c *= 2;  //c = c*2
        System.out.println(c);
        d /= 1;
        System.out.println(d);

        int[] arr = {2,3,1,5};
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length -1 -i; j++) {
                if (arr[j] > arr[j+1]){
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));



        for (int i = 0; i < arr.length - 1; i++) {
            int minIndex = i;
            for (int j = i+1; j < arr.length; j++) {
                if(arr[minIndex] < arr[j]){
                    minIndex = j;
                }
            }
            int temp = arr[i];
            arr[i] = arr[minIndex];
            arr[minIndex] = temp;

        }
        System.out.println(Arrays.toString(arr));
    }


}
